<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>alias</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_000_020">&nbsp;</a>NAME</h4><blockquote>
alias - define or display aliases
</blockquote><h4><a name = "tag_000_000_021">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

alias <b>[</b><i>alias-name</i><b>[</b>=<i>string</i><b>]</b> ...<b>]
</b></code>
</pre>
</blockquote><h4><a name = "tag_000_000_022">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>alias</i>
utility creates or redefines alias definitions or writes
the values of existing alias definitions to standard output.
An alias definition provides a string value
that replaces a command name when it is encountered.
See
<xref href=alsub><a href="chap2.html#tag_001_003_001">
Alias Substitution
</a></xref>.
<p>
An alias definition affects the current shell execution environment
and the execution environments of the subshells of the current shell.
When used as specified by this specification, the alias definition
will not affect the parent process of the current shell
nor any utility environment invoked by the shell.
See
<xref href=shexenv><a href="chap2.html#tag_001_012">
Shell Execution Environment
</a></xref>.
</blockquote><h4><a name = "tag_000_000_023">&nbsp;</a>OPTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_024">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>alias-name</i><dd>
Write the alias definition to standard output.

<dt><i>alias-name</i><b>=</b><i>string</i><dd>
Assign the value of
<i>string</i>
to the alias
<i>alias-name</i>.

</dl>
<p>
If no operands are given, all alias definitions
will be written to standard output.
</blockquote><h4><a name = "tag_000_000_025">&nbsp;</a>STDIN</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_000_000_026">&nbsp;</a>INPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_027">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>alias</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
</dl>
</blockquote><h4><a name = "tag_000_000_028">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_000_000_029">&nbsp;</a>STDOUT</h4><blockquote>
The format for displaying aliases (when no operands or only
<i>name</i>
operands are specified) is:
<code>
<p>
<tt>"%s=%s\n"</tt>, <i>name</i>,
<i>value</i>
</code>
<p>
The
<i>value</i>
string will be written with appropriate quoting so that it is
suitable for reinput to the shell.
See the description of shell quoting in
<xref href=quoting><a href="chap2.html#tag_001_002">
Quoting
</a></xref>.
</blockquote><h4><a name = "tag_000_000_030">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_000_000_031">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_032">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_033">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful completion.

<dt>&gt;0<dd>One of the
<i>name</i>
operands specified did not have an alias definition, or
an error occurred.

</dl>
</blockquote><h4><a name = "tag_000_000_034">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_000_000_035">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_036">&nbsp;</a>EXAMPLES</h4><blockquote>
<ol>
<p>
<li>
Change
<i><a href="ls.html">ls</a></i>
to give a columnated, more annotated output:
<pre>
<code>
alias ls="ls -CF"
</code>
</pre>
<p>
<li>
Create a simple &quot;redo&quot; command to repeat previous entries in the
command history file:
<pre>
<code>
alias r='fc -s'
</code>
</pre>
<p>
<li>
Use 1K units for
<i><a href="du.html">du</a></i>:
<pre>
<code>
alias du=du\ -k
</code>
</pre>
<p>
<li>
Set up
<i><a href="nohup.html">nohup</a></i>
so that it can deal with an argument that is itself an alias name:
<pre>
<code>
alias nohup="nohup "
</code>
</pre>
<p>
</ol>
</blockquote><h4><a name = "tag_000_000_037">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_000_038">&nbsp;</a>SEE ALSO</h4><blockquote>
<xref href=funccmd><a href="chap2.html#tag_001_009_005">
Function Definition Command
</a></xref>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
